<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<sec:authentication property="principal" var="currentPrincipal" scope="page"/>

<div id="anchor-parking-resource" class="block-heading">
  <h5>停车场资源</h5>
  <c:if test="${supplierMenuType != 'sub'}">
    <a href="${ctx.host}/suppliers/${supplier.id}/parking-resource/create" data-target="#edit" data-toggle="modal" title="Edit" class="pull-right"
      style="font-size: 12px; padding-top: 20px;">新增</a>
  </c:if>
</div>

<table class="table table-hover ms-table ">
  <thead>
      <tr>
        <th>位置</th>
        <th>面积</th>
        <th>场地来源</th>
        <th>到期日期</th>
        <c:if test="${supplierMenuType != 'sub'}">
          <th>操作</th>
        </c:if>
      </tr>
  </thead>
  <tbody>
      <c:forEach items="${parkingResources}" var="parkingResource" varStatus="status"> 
      <tr>
        <td>${empty parkingResource.position ? '无' : parkingResource.position}</td>
        <td>
          <c:choose>
            <c:when test="${empty parkingResource.area}">
              无
            </c:when>
            <c:otherwise>
              ${parkingResource.area}&nbsp;平方
            </c:otherwise>
          </c:choose>
        </td>
        <td>${empty parkingResource.fieldSource.description ? '无' : parkingResource.fieldSource.description}</td>
        <td><fmt:formatDate value="${parkingResource.expireDate}" pattern="yyyy-MM-dd"/></td>
        <c:if test="${supplierMenuType != 'sub'}">
          <td>
           <a href="${ctx.host}/suppliers/${supplier.id}/parking-resource/${parkingResource.id}/edit" data-target="#edit" data-toggle="modal">修改</a>&nbsp;&nbsp;
           <a href="${ctx.host}/suppliers/${supplier.id}/parking-resource/${parkingResource.id }/delete" data-target="#delete" data-toggle="modal">删除</a>&nbsp;&nbsp;
          </td>
        </c:if>
      </tr>
    </c:forEach> 
  </tbody>
</table>